package com.github.appintro.example.ui.custom;

import com.github.appintro.AppIntro;
import com.github.appintro.AppIntroFragment;
import com.github.appintro.SlidePolicy;
import com.github.appintro.example.ui.custom.fragments.CustomSlidePolicyFragment;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;

public class SlidePolicyIntro extends AppIntro {
    @Override
    public void onStart(Intent savedInstanceState) {
        setLayoutId();
        super.onStart(savedInstanceState);
        this.addSlide(new AppIntroFragment(this, "Welcome", "This is a demo of the AppIntro library, using the SlidePolicy feature.", 0,
                0,
                0,
                0,
                0,
                0,
                null,
                null,
                null));
        this.addSlide(new CustomSlidePolicyFragment(this));
        this.addSlide(new AppIntroFragment(this, "Policy Respected!", "If the user arrived here, the SlidePolicy was respected.", 0,
                0,
                0,
                0,
                0,
                0,
                null,
                null,
                null));
    }

    public void onSkipPressed(Component currentFragment) {
        super.onSkipPressed(currentFragment);
        terminateAbility();
    }

    public void onDonePressed(Component currentFragment) {
        super.onDonePressed(currentFragment);
        terminateAbility();
    }
}